import request from '@/utils/request'
/**
 * 获取所有频道
 */
export const getAllChannels = () => {
  return request({
    method: 'GET',
    url: '/app/v1_0/channels'
  })
}

/**
 * 添加用户频道
 * restful api
 * get post put delete
 *
 * 增删改查
 *
 *  get,post 传统接口风格 IE只认这二种
 *
 *  restful api 好处语义化更强一点
 *  get,post,put,delete,
 *
 *  put 完全修改
 *  patch 部分修改 打补丁式修改
 *
 *  div
 *
 * p,h1,
 *
 */
export const addUserChannel = channel => {
  return request({
    method: 'PATCH',
    url: '/app/v1_0/user/channels',
    data: {
      channels: [channel]
    }
  })
}

/**
 * 删除用户频道
 */
export const deleteUserChannel = channelId => {
  return request({
    method: 'DELETE',
    url: `/app/v1_0/user/channels/${channelId}`
  })
}
